
/**
* Change the current value of this item
*
* @param  string    thisSelection
* @param  string    thisObject
*
*/
function chgCurValue(thisSelection, thisObject){
  
  var _CONN_ERROR = "****";
  var _RET_NULL   = " ";
  
  var theUrl;
  var theParams;
  
  thisObject = document.getElementsByName(thisObject);
  thisObject = thisObject[0];
  
  var xmlHttp =	new XMLHttpRequest();
  
  /**
  * Init the url and params based 
  * thisObject properties
  *
  */
  switch(thisSelection){
    
    case "language":
      
      theUrl    = "/ecs/tocmenu_Y/controllers/initLanguage.php";
      theParams = "language=" + thisObject.value;
      break;
      
    case "currency":
      
      theUrl    = "/ecs/tocmenu_Y/controllers/initCurrency.php";
      theParams = "currency=" + thisObject.value;
      break;
      
    case "levelD":
      
      theUrl    = "/ecs/tocmenu_Y/controllers/initLevelD.php";
      theParams = "levelD=" + thisObject.value;
      break;
    
    case "method":
      
      theUrl    = "/ecs/tocmenu_Y/controllers/initMethod.php";
      theParams = "method=" + thisObject.value;
      break;
      
    default:
      alert("Error Unknown Category");
  }
    
  var url 		= theUrl + "?sid="+Math.random();
	var params 	= theParams;
	
	xmlHttp.open("POST", url, false);
	
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	
	xmlHttp.onreadystatechange = function() {//Call a function when the state changes.
		
	}
	
	xmlHttp.send(params);
	
	switch(xmlHttp.responseText){
        
    case _CONN_ERROR:
      
      alert("Oracle connection failed");
      break;
      
    default:
  }
}

/**
* reset/init periode
*
* @param  string  srcObject
*
*/
function resetPeriode(srcObject){
  
  var _CONN_ERROR = "****";
  var _RET_NULL   = " ";
  
  srcObject = document.getElementsByName(srcObject);
  
  if(srcObject.length > 0){
  
    srcObject = srcObject[0];
  }
  
  var thisPeriode = srcObject.value;
  
  var theUrl    = "/ecs/tocmenu_Y/controllers/initPeriode.php";
  var theParams = "thisPeriode=" + thisPeriode;
  
  var url 		= theUrl + "?sid="+Math.random();
	var params 	= theParams;
	
	var xmlHttp =	new XMLHttpRequest();
  
	xmlHttp.open("POST", url, true);
	
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	
	xmlHttp.onreadystatechange = function() {//Call a function when the state changes.
		
		//alert("readyState :" + xmlHttp.readyState + " and status :" + xmlHttp.status);
		
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
		  
		  //alert(xmlHttp.responseText);
		  
		  switch(xmlHttp.responseText){
		    
		    case _CONN_ERROR:
		      
		      alert("Oracle connection failed");
		      break;
		      
		    default:
		  }
		  
		}
	}
	
	xmlHttp.send(params);
}